# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Forms.V1.Model.Form do
  @moduledoc """
  A Google Forms document. A form is created in Drive, and deleting a form or changing its access protections is done via the [Drive API](https://developers.google.com/drive/api/v3/about-sdk).

  ## Attributes

  *   `formId` (*type:* `String.t`, *default:* `nil`) - Output only. The form ID.
  *   `info` (*type:* `GoogleApi.Forms.V1.Model.Info.t`, *default:* `nil`) - Required. The title and description of the form.
  *   `items` (*type:* `list(GoogleApi.Forms.V1.Model.Item.t)`, *default:* `nil`) - Required. A list of the form's items, which can include section headers, questions, embedded media, etc.
  *   `linkedSheetId` (*type:* `String.t`, *default:* `nil`) - Output only. The ID of the linked Google Sheet which is accumulating responses from this Form (if such a Sheet exists).
  *   `publishSettings` (*type:* `GoogleApi.Forms.V1.Model.PublishSettings.t`, *default:* `nil`) - Output only. The publishing settings for a form. This field isn't set for legacy forms because they don't have the `publish_settings` field. All newly created forms support publish settings. Forms with `publish_settings` value set can call SetPublishSettings API to publish or unpublish the form.
  *   `responderUri` (*type:* `String.t`, *default:* `nil`) - Output only. The form URI to share with responders. This opens a page that allows the user to submit responses but not edit the questions. For forms that have `publish_settings` value set, this will be the published form URI.
  *   `revisionId` (*type:* `String.t`, *default:* `nil`) - Output only. The revision ID of the form. Used in the WriteControl in update requests to identify the revision on which the changes are based. The format of the revision ID may change over time, so it should be treated opaquely. A returned revision ID is only guaranteed to be valid for 24 hours after it has been returned and cannot be shared across users. If the revision ID is unchanged between calls, then the form *content* has not changed. Conversely, a changed ID (for the same form and user) usually means the form *content* has been updated; however, a changed ID can also be due to internal factors such as ID format changes. Form content excludes form metadata, including: * sharing settings (who has access to the form) * `publish_settings` (if the form supports publishing and if it is published)
  *   `settings` (*type:* `GoogleApi.Forms.V1.Model.FormSettings.t`, *default:* `nil`) - The form's settings. This must be updated with UpdateSettingsRequest; it is ignored during `forms.create` and UpdateFormInfoRequest.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :formId => String.t() | nil,
          :info => GoogleApi.Forms.V1.Model.Info.t() | nil,
          :items => list(GoogleApi.Forms.V1.Model.Item.t()) | nil,
          :linkedSheetId => String.t() | nil,
          :publishSettings => GoogleApi.Forms.V1.Model.PublishSettings.t() | nil,
          :responderUri => String.t() | nil,
          :revisionId => String.t() | nil,
          :settings => GoogleApi.Forms.V1.Model.FormSettings.t() | nil
        }

  field(:formId)
  field(:info, as: GoogleApi.Forms.V1.Model.Info)
  field(:items, as: GoogleApi.Forms.V1.Model.Item, type: :list)
  field(:linkedSheetId)
  field(:publishSettings, as: GoogleApi.Forms.V1.Model.PublishSettings)
  field(:responderUri)
  field(:revisionId)
  field(:settings, as: GoogleApi.Forms.V1.Model.FormSettings)
end

defimpl Poison.Decoder, for: GoogleApi.Forms.V1.Model.Form do
  def decode(value, options) do
    GoogleApi.Forms.V1.Model.Form.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Forms.V1.Model.Form do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
